<template>
	<view class="page">
		<view class="head">
			<view class="head1">
			
				
				
			</view>
		</view>
	<view class="main">
		<!-- 搜索 -->
			<view class="search-head">
				
				<view class="search">
					
					<input type="text" v-model="keyword" placeholder="搜索消息" />
				</view>
				
			</view>
			<view class="share">
				<view class="trasnicon">
					推荐成功<text class="number">15</text>人，获得积分<text class="number">300</text>分
				</view>
				<view class="title" v-if="!isShow">
					创建群聊
				</view>
			</view>
			<!-- 消息详情 -->
			<scroll-view class="message" scroll-y="true" style="height:800px;">
				<view class="item" v-if="level==1"  v-for="(item, index) in news1" :key="index" @click="item">
				  <image :src="item.logo" mode=""></image>
				  <view class="right">
				    <view class="top">
				      <view class="title">
				       {{item.name}}
				      </view>
				      <view class="time">
				        <!-- You can add time here if needed -->
				      </view>
				    </view>
				    <view class="bottom">
				      {{item.message}}
				    </view>
				  </view>
				</view>
			  <view class="item"  v-for="(item, index) in news" :key="index" @click="item">
			    <image :src="item.logo" mode=""></image>
			    <view class="right">
			      <view class="top">
			        <view class="title">
			         {{item.name}}
			        </view>
			        <view class="time">
			          <!-- You can add time here if needed -->
			        </view>
			      </view>
			      <view class="bottom">
			        {{item.message}}
			      </view>
			    </view>
			  </view>
			</scroll-view>


			
	</view>
	<TabBar :tabBarShow="1"></TabBar>
	</view>
		
</template>
	


<script>
import TabBar from '../../components/TabBar/TabBar.vue';
	export default {
		
		data() {
			return {
				isLogin: !!uni.getStorageSync('_login'),
				isShow:true,
				keyword: '',
				level:'',
				news1:[
					{
						logo:'../../static/1.jpg',
						name:'杨国富麻辣烫群',
						message:'欢迎您',
						
						
					},
				],
				news:[
					
					{
						logo:'https://so.360tres.com/dmsmty/80_80_100/t0111bedfee0171ed21.webp',
						name:' 重庆老灶老火锅店',
						message:'欢迎您',	
					}
				]
      
			}
		},
		onLoad(params) {
			this.keyword = decodeURIComponent(params.keyword||'');
		},
		onShow() {
			const userInfo = uni.getStorageSync('_UserInfo');
			this.level=userInfo.level;
			console.log('level',this.level)
		},
		methods: {
		
			goBack(){
				uni.navigateBack(-1);
			},
			item(){
				uni.navigateTo({
					url:'/pages/friendsDetail/friendsDetail'
				})
			}
			
			
		}
	}
</script>

<style scoped lang="scss">
	@import  'friends.scss';
</style>
